var express = require('express');
var router = express.Router();
var rests = require('../controllers/services');


//接口实例
router.get('/login', function (req, res) {
    rests.get(req,'/authentication/getPages',function (data) {
        res.json(data);
    });
});

//接口实例post
router.post('/post', function (req, res) {
    rests.post(req,'/unionMkt/getMarketData',function (data) {
        res.json(data);
    });
});

//外部数据接口测试
router.get('/booksService/:month/:day', function (req, res) {
    rests.gets(req,'/queryEvent.php?key=2b8a660b4df88775cb6bcff5b1ccb342&date='+req.params.month+"/"+req.params.day, function (data) {
        res.json(data);
    });
});

router.get('/booksId/:id', function (req, res) {
    rests.gets(req,'/queryDetail.php?key=2b8a660b4df88775cb6bcff5b1ccb342&e_id='+req.params.id, function (data) {
        res.json(data);
    });
});

module.exports = router;
